主题
添加自定义DMA设备 - DmaAddDeviceEx
函数简介
添加自定义 DMA 设备,支持多种设备类型和连接方式,通过连接字符串灵活配置设备参数。(高级版功能,普通版无法使用)
接口名称
DmaAddDeviceExDLL调用
c
int64_t OLA_CALL_TYPE DmaAddDeviceEx(int64_t instance, OLA_STRING_INPUT connectionString);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| connectionString | 字符串 | 设备连接字符串 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// connectionString 为自定义 DMA 连接串
long deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1");csharp
using OLAPlug;
var ola = new OLAPlugServer();
// connectionString 为自定义 DMA 连接串
long deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
# connectionString 为自定义 DMA 连接串
deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
// connectionString 为自定义 DMA 连接串
long deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1");cpp
var ola = com("OlaPlug.OlaSoft")
// connectionString 为自定义 DMA 连接串
var deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
' connectionString 为自定义 DMA 连接串
deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1")text
.局部变量 ola, OLAPlug
ola.创建 ()
' connectionString 为自定义 DMA 连接串
deviceId = ola.DmaAddDeviceEx(“vmware://guest?id=1“)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
// connectionString 为自定义 DMA 连接串
var deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
// connectionString 为自定义 DMA 连接串
长整数 deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// connectionString 为自定义 DMA 连接串
long deviceId = ola.DmaAddDeviceEx("vmware://guest?id=1");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
long deviceId = DmaAddDeviceEx(instance, "vmware://guest?id=1");csharp
long instance = CreateCOLAPlugInterFace();
long deviceId = DmaAddDeviceEx(instance, "vmware://guest?id=1");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
deviceId = DmaAddDeviceEx(instance, "vmware://guest?id=1")返回值
长整数型:成功返回设备ID (>=0),失败返回 -1。
注意事项
- 连接字符串格式:
vmware://rw=1,id=1(rw: 0=只读, 1=读写;id: 虚拟机ID) - 连接字符串格式:
fpga://algo=4(algo: 算法编号) - 其他自定义格式根据具体设备类型定义
